<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<meta http-equiv="Pragma" content="no-cache"> 
<meta http-equiv="Cache-Control" content="no-cache"> 
<meta http-equiv="Expires" content="0"> 
<title>在线客服登录</title>
<link href="/static/service/login.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/static/layim/css/layui.css?v=2.3">
<script type="text/javascript" src="/static/js/jquery.min.js?v=2.3"></script>
<script src="/static/layim/layui.js"></script>
</head>

<body>
<div class="login_box">
      <div class="login_l_img"><img src="/static/service/images/login-img.png" /></div>
      <div class="login">
          <div class="login_logo"><a href="#"><img src="/static/service/images/login_logo.png" /></a></div>
          <div class="login_name">
               <p>在线客服账号登录</p>
          </div>
          <form method="post" class="layui-form">
              <input name="name" type="text" placeholder="用户名" lay-verify="required">
              <input name="password" type="password" placeholder="输入密码" lay-verify="required"/>
              <input type="hidden" name="room_id" value="{$room_id}">
              <input value="登录" style="width:100%;" type="button" lay-submit lay-filter="login">
          </form>
      </div>
      <div class="copyright">@在线客服平台-zhuqingwen</div>
</div>
</body>
<script type="text/javascript">
    layui.use(['layer','form'], function(){
        var layer  = layui.layer;
        var form   = layui.form;
        form.on('submit(login)', function(data){
        $.ajax({
            url: "/index/service/serviceLogin",
            data: data.field,
            type: 'post',
            dataType: "json",
            async: false,
            success: function (response) {
                if (response.code == '200') {
                    layer.msg(response.msg);
                    setTimeout(function () {
                        window.location.href = '/service?room_id='+{$room_id};
                    }, 1000)
                } else {
                    layer.msg(response.msg);
                    return false;
                }
            }
        })
        return false;
        });
    })
</script>
</html>
